package com.lhm.service;


import com.lhm.entity.Book;
import com.lhm.mapper.BookMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    BookMapper bookMapper;

    @Override
    public Book findById(int id) {
        return bookMapper.findById(id);
    }

    @Override
    public List<Book> findAll() {
        return bookMapper.findAll();
    }

    @Override
    public void addBook(Book book) {
        bookMapper.addBook(book);
    }

    @Override
    public void update(Book book) {
        bookMapper.update(book);
    }

    @Override
    public List<Book> findPage(@Param("start") int n1, @Param("num") int n2, @Param("typeid") int n3) {
        return bookMapper.findPage(n1, n2, n3);
    }

    @Override
    public int getCount(int n) {
        return bookMapper.getCount(n);
    }

    @Override
    public List<Book> findByName(String name, int n1, int n2) {
        return bookMapper.findByName(name, n1, n2);
    }

    @Override
    public int getCountByName(String name) {
        return bookMapper.getCountByName(name);
    }

    @Override
    public List<Book> findRate5() {
        return bookMapper.findRate5();
    }

    @Override
    public List<Book> findSale5() {
        return bookMapper.findSale5();
    }

    @Override
    public List<Book> findFav5() {
        return bookMapper.findFav5();
    }

    @Override
    public List<Book> findPageRate(int n1, int n2, int n3) {
        return bookMapper.findPageRate(n1, n2, n3);
    }

    @Override
    public List<Book> findPageSale(int n1, int n2, int n3) {
        return bookMapper.findPageSale(n1, n2, n3);
    }

    @Override
    public List<Book> findPageFav(int n1, int n2, int n3) {
        return bookMapper.findPageFav(n1, n2, n3);
    }

    @Override
    public void addFavnum(int id, int num) {
        bookMapper.addFavnum(id,num);
    }
}
